
'  Copyright 2011 Prof K.Sridharan
'  This file is part of SAP2
'
'    SAP2 is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    SAP2 is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'   You should have received a copy of the GNU General Public License
'    along with SAP2.  If not, see <http://www.gnu.org/licenses/>.


VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmGridPTrip 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Pump Trip Details"
   ClientHeight    =   3750
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4575
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3750
   ScaleWidth      =   4575
   ShowInTaskbar   =   0   'False
   Begin VB.Frame frmINRVs 
      Caption         =   "Running / Failing Pump "
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2895
      Left            =   360
      TabIndex        =   2
      Top             =   240
      Width           =   3855
      Begin VB.TextBox Text2 
         Height          =   195
         Left            =   600
         TabIndex        =   3
         Top             =   720
         Visible         =   0   'False
         Width           =   855
      End
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   2175
         Left            =   200
         TabIndex        =   0
         Top             =   480
         Width           =   3450
         _ExtentX        =   6085
         _ExtentY        =   3836
         _Version        =   393216
         Cols            =   3
         FixedCols       =   2
         RowHeightMin    =   400
         WordWrap        =   -1  'True
         AllowUserResizing=   3
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "&OK"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Top             =   3240
      Width           =   855
   End
End
Attribute VB_Name = "frmGridPTrip"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const TOTALCOLUMNS = 3  'Zero based

Private Sub cmdOK_Click()
Dim ii As Integer
Dim jj As Integer
 
 For ii = 1 To NPMP
  If MSFlexGrid1.TextMatrix(ii, 2) = "Running" Then
   ITRIPP(ii) = 0
  ElseIf MSFlexGrid1.TextMatrix(ii, 2) = "Failing" Then
   ITRIPP(ii) = 1
  End If
 Next
 
Me.Hide
frmWaveTrip.Enabled = True
MDIForm1.mnuExec.Item(10).Enabled = True
MDIForm1.tbrMain.Buttons(6).Enabled = True
End Sub
Private Sub Form_Load()
   Dim iCount As Integer
   Dim myArray As Variant
    Left = 20
    Top = 30
     
    myArray = Array("Sl. No.", "Node No.", "Trip Code")
   
   MSFlexGrid1.Rows = NPMP + 1
   MSFlexGrid1.Cols = TOTALCOLUMNS  'Non-zero based
   MSFlexGrid1.FixedRows = 1
   MSFlexGrid1.FixedCols = 2
   MSFlexGrid1.FocusRect = flexFocusNone
   'add headings to grid
   MSFlexGrid1.Row = 0
      
   For iCount = 0 To TOTALCOLUMNS - 1 'Zero based
      MSFlexGrid1.ColWidth(iCount) = 1000
      MSFlexGrid1.Col = iCount
      MSFlexGrid1.Text = myArray(iCount)
   Next iCount
       
       ii = 0
       For i = 1 To NNMAX
        If (NTYPE(i) = 8) Then
         ii = ii + 1
         MSFlexGrid1.TextMatrix(ii, 0) = ii
         MSFlexGrid1.TextMatrix(ii, 1) = i
         MSFlexGrid1.TextMatrix(ii, 2) = "Running"
       End If
       Next
   
  If Not OpenFile = "" Then
   For ii = 1 To MSFlexGrid1.Rows - 1
     If ITRIPP(ii) = 0 Then
      MSFlexGrid1.TextMatrix(ii, 2) = "Running"
     ElseIf ITRIPP(ii) = 1 Then
      MSFlexGrid1.TextMatrix(ii, 2) = "Failing"
     End If
   Next
  End If
   'highlight 1st row
   HighLightGridRow (1)
End Sub
Private Sub HighLightGridRow(iRow As Integer)
   MSFlexGrid1.Col = 2
   MSFlexGrid1.Row = iRow
   MSFlexGrid1.ColSel = TOTALCOLUMNS - 1 'Zero Based
   MSFlexGrid1.RowSel = iRow
End Sub
Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
  'MSHFlexGridEdit MSFlexGrid1, Text2, KeyAscii
  If MSFlexGrid1.Text = "Running" Then
   MSFlexGrid1.Text = "Failing"
  ElseIf MSFlexGrid1.Text = "Failing" Then
   MSFlexGrid1.Text = "Running"
  End If
End Sub
Sub MsFlexGrid1_DblClick()
    'MSHFlexGridEdit MSFlexGrid1, Text2, 32
  If MSFlexGrid1.Text = "Running" Then
   MSFlexGrid1.Text = "Failing"
  ElseIf MSFlexGrid1.Text = "Failing" Then
   MSFlexGrid1.Text = "Running"
  End If
End Sub

